<?php
/**
 * SDForecastRequest
 *
 * PHP version 5
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */

/**
 * Amazon Ads API for Sponsored Display
 *
 * This API enables programmatic access for campaign creation, management, and reporting for Sponsored Display campaigns. For more information on the functionality, see the [Sponsored Display Support Center](https://advertising.amazon.com/help#GTPPHE6RAWC2C4LZ). For API onboarding information, see the [account setup](https://advertising.amazon.com/API/docs/en-us/guides/onboarding/overview) topic.<br/><br/> > This specification is available for download from the **[Advertising API developer portal](https://d3a0d0y2hgofx6.cloudfront.net/openapi/en-us/sponsored-display/3-0/openapi.yaml).**
 *
 * OpenAPI spec version: 3.0
 * 
 * Generated by:https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api.git
 * AmazonAdvertisingApi Codegen version: 3.0.51
 */
/**
 * NOTE: This class is auto generated by the AmazonAdvertisingApi code generator program.
 *https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 * Do not edit the class manually.
 */

namespace AmazonAdvertisingApi\Model;

use \ArrayAccess;
use \AmazonAdvertisingApi\ObjectSerializer;

/**
 * SDForecastRequest Class Doc Comment
 *
 * @category Class
 * @description Request payload for SD forecasting. Below are required and optional fields. Fields not listed will not impact forecast results. |Field              |Object            |Required| |-------------------|------------------|--------| |startDate          |Campaign          |required| |endDate            |Campaign          |optional| |costType           |Campaign          |optional| |bidOptimization    |AdGroup           |required| |creativeType       |AdGroup           |optional| |defaultBid         |AdGroup           |optional| |asin               |ProductAds        |required for vendors| |sku                |ProductAds        |required for sellers| |bid                |TargetingClauses  |required when defaultBid is not set| |expression         |TargetingClauses  |required| |ruleConditions     |OptimizationRules |optional|
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */
class SDForecastRequest implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $AmazonAdvertisingApiModelName = 'SDForecastRequest';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiTypes = [
        'campaign' => '\AmazonAdvertisingApi\Model\Campaign',
        'ad_group' => '\AmazonAdvertisingApi\Model\AdGroup',
        'optimization_rules' => '\AmazonAdvertisingApi\Model\OptimizationRule[]',
        'product_ads' => '\AmazonAdvertisingApi\Model\ProductAd[]',
        'targeting_clauses' => '\AmazonAdvertisingApi\Model\SDForecastRequestTargetingClause[]',
        'negative_targeting_clauses' => '\AmazonAdvertisingApi\Model\NegativeTargetingClause[]'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiFormats = [
        'campaign' => null,
        'ad_group' => null,
        'optimization_rules' => null,
        'product_ads' => null,
        'targeting_clauses' => null,
        'negative_targeting_clauses' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiTypes()
    {
        return self::$AmazonAdvertisingApiTypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiFormats()
    {
        return self::$AmazonAdvertisingApiFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'campaign' => 'campaign',
        'ad_group' => 'adGroup',
        'optimization_rules' => 'optimizationRules',
        'product_ads' => 'productAds',
        'targeting_clauses' => 'targetingClauses',
        'negative_targeting_clauses' => 'negativeTargetingClauses'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'campaign' => 'setCampaign',
        'ad_group' => 'setAdGroup',
        'optimization_rules' => 'setOptimizationRules',
        'product_ads' => 'setProductAds',
        'targeting_clauses' => 'setTargetingClauses',
        'negative_targeting_clauses' => 'setNegativeTargetingClauses'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'campaign' => 'getCampaign',
        'ad_group' => 'getAdGroup',
        'optimization_rules' => 'getOptimizationRules',
        'product_ads' => 'getProductAds',
        'targeting_clauses' => 'getTargetingClauses',
        'negative_targeting_clauses' => 'getNegativeTargetingClauses'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$AmazonAdvertisingApiModelName;
    }



    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['campaign'] = isset($data['campaign']) ? $data['campaign'] : null;
        $this->container['ad_group'] = isset($data['ad_group']) ? $data['ad_group'] : null;
        $this->container['optimization_rules'] = isset($data['optimization_rules']) ? $data['optimization_rules'] : null;
        $this->container['product_ads'] = isset($data['product_ads']) ? $data['product_ads'] : null;
        $this->container['targeting_clauses'] = isset($data['targeting_clauses']) ? $data['targeting_clauses'] : null;
        $this->container['negative_targeting_clauses'] = isset($data['negative_targeting_clauses']) ? $data['negative_targeting_clauses'] : null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        if ($this->container['campaign'] === null) {
            $invalidProperties[] = "'campaign' can't be null";
        }
        if ($this->container['ad_group'] === null) {
            $invalidProperties[] = "'ad_group' can't be null";
        }
        if ($this->container['product_ads'] === null) {
            $invalidProperties[] = "'product_ads' can't be null";
        }
        if ($this->container['targeting_clauses'] === null) {
            $invalidProperties[] = "'targeting_clauses' can't be null";
        }
        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }


    /**
     * Gets campaign
     *
     * @return \AmazonAdvertisingApi\Model\Campaign
     */
    public function getCampaign()
    {
        return $this->container['campaign'];
    }

    /**
     * Sets campaign
     *
     * @param \AmazonAdvertisingApi\Model\Campaign $campaign campaign
     *
     * @return $this
     */
    public function setCampaign($campaign)
    {
        $this->container['campaign'] = $campaign;

        return $this;
    }

    /**
     * Gets ad_group
     *
     * @return \AmazonAdvertisingApi\Model\AdGroup
     */
    public function getAdGroup()
    {
        return $this->container['ad_group'];
    }

    /**
     * Sets ad_group
     *
     * @param \AmazonAdvertisingApi\Model\AdGroup $ad_group ad_group
     *
     * @return $this
     */
    public function setAdGroup($ad_group)
    {
        $this->container['ad_group'] = $ad_group;

        return $this;
    }

    /**
     * Gets optimization_rules
     *
     * @return \AmazonAdvertisingApi\Model\OptimizationRule[]
     */
    public function getOptimizationRules()
    {
        return $this->container['optimization_rules'];
    }

    /**
     * Sets optimization_rules
     *
     * @param \AmazonAdvertisingApi\Model\OptimizationRule[] $optimization_rules A list of SD optimization rules. Forecast will be affected by the optimization strategy rules.  Currently, supported rule metrics by forecast are `COST_PER_CLICK`, `COST_PER_THOUSAND_VIEWABLE_IMPRESSIONS` and `COST_PER_ORDER`.
     *
     * @return $this
     */
    public function setOptimizationRules($optimization_rules)
    {
        $this->container['optimization_rules'] = $optimization_rules;

        return $this;
    }

    /**
     * Gets product_ads
     *
     * @return \AmazonAdvertisingApi\Model\ProductAd[]
     */
    public function getProductAds()
    {
        return $this->container['product_ads'];
    }

    /**
     * Sets product_ads
     *
     * @param \AmazonAdvertisingApi\Model\ProductAd[] $product_ads product_ads
     *
     * @return $this
     */
    public function setProductAds($product_ads)
    {
        $this->container['product_ads'] = $product_ads;

        return $this;
    }

    /**
     * Gets targeting_clauses
     *
     * @return \AmazonAdvertisingApi\Model\SDForecastRequestTargetingClause[]
     */
    public function getTargetingClauses()
    {
        return $this->container['targeting_clauses'];
    }

    /**
     * Sets targeting_clauses
     *
     * @param \AmazonAdvertisingApi\Model\SDForecastRequestTargetingClause[] $targeting_clauses A list of SD targeting clauses.
     *
     * @return $this
     */
    public function setTargetingClauses($targeting_clauses)
    {
        $this->container['targeting_clauses'] = $targeting_clauses;

        return $this;
    }

    /**
     * Gets negative_targeting_clauses
     *
     * @return \AmazonAdvertisingApi\Model\NegativeTargetingClause[]
     */
    public function getNegativeTargetingClauses()
    {
        return $this->container['negative_targeting_clauses'];
    }

    /**
     * Sets negative_targeting_clauses
     *
     * @param \AmazonAdvertisingApi\Model\NegativeTargetingClause[] $negative_targeting_clauses A list of SD negative targeting clauses.
     *
     * @return $this
     */
    public function setNegativeTargetingClauses($negative_targeting_clauses)
    {
        $this->container['negative_targeting_clauses'] = $negative_targeting_clauses;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    #[\ReturnTypeWillChange]
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
     * Sets value based on offset.
     *
     * @param integer $offset Offset
     * @param mixed   $value  Value to be set
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}
